from PIL import Image

file_path = './SquareModel/%d.png'
file_number = 20

file_list = [file_path % i for i in range(file_number)]

frames = [Image.open(file).convert('RGB') for file in file_list]

frames[0].save('test.gif', format='gif',
               append_images=frames[1:], save_all=True, duration=100, loop=0)
